//  - main处理函数
exports.issetHeader = '自定义设置头部';
exports.main = (req,res) =>{
    const tool = require(req.bind.dir+'/module/emma.js');
    var HTML = tool.require('html');
    var h = new HTML();

    h.isMobile(req,tool);
    h.load({title:'Home of NodeJs Server'});
    h.appHead('<meta charset="utf-8">');
    var html = '';
    var d = new Date();
    html += '<h1> Hello World Node Server In app!</h1>';
    html += `<nav>
        <a href="/httpbin" title="http 相关属性查看">httpbin</a>
        <a href="/npmlist" title="npm list命令">npm 清单</a>
        <a href="/Node/os" title="Node 命令">Node</a>
        <a href="/api/" title="Node 命令">API</a>
        <a href="/log" title="系统日志" target="_blank">日志</a>
    </nav>`;
    html += `<div>${d}<br>${tool.date()}<br>${tool.date('Y年M月D日 H:i:s')}</div>`;
    //console.log(d);
       
    var ctt = req.session.get('visit_count');
    if(!ctt){
        req.session.set('visit_count',1);
        ctt = 1;
    }
    html += `<p>系统当前访问量：${ctt}</p>`;
    h.appBody(html); 
    tool.head(res);
    res.write(h.getHtml());
}